/*
void GPIO2SwitchCheck()
{
  byte rf22reg = rf22.spiRead(RF22_REG_0E_IO_PORT_CONFIGURATION);
  //Serial.println(rf22reg, BIN);

  if (rf22reg & (1<<2))
  {
    digitalWrite(redLED, HIGH);
    rf22.setTxPower(RF22_TXPOW_8DBM);
  }
  else
  {
    digitalWrite(redLED, LOW);
    rf22.setTxPower(RF22_TXPOW_1DBM);
  }
}
*/
void RSSI()
{
    rssi = rf22.lastRssi();
    
    //Serial.println(rf22.spiRead(RF22_REG_2B_AFC_CORRECTION_READ)*156.25,DEC);
    //Serial.println(rssi);

    if (rssi > 125)
    {
      digitalWrite(greenLED, HIGH);
      digitalWrite(redLED, HIGH);
    }
    else if (rssi > 85)
    {
      digitalWrite(greenLED, HIGH);
      digitalWrite(redLED, HIGH);
    }
    else if (rssi > 60)
    {
      digitalWrite(greenLED, LOW);
      digitalWrite(redLED, HIGH);
    }
    else
    {
      digitalWrite(greenLED, LOW);
      digitalWrite(redLED, LOW);
    }
}

void checkRF22Lockup()
{
  //Has problems, do not use this function
  //Serial.println(rf22.spiRead(RF22_REG_0C_GPIO_CONFIGURATION1));
  if(rf22.spiRead(RF22_REG_0C_GPIO_CONFIGURATION1) == 0)
  {
    RF22Initialization();
    Serial.println("shit");
  }
}


